<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>内置关系</title>
    <script src="../js/vue.js">
    </script>
    <style>
        .v-cloak {
            display: none;
        }
    </style>
</head>
<body>

<div id="root">

    <!--

     //VueComponent的原型链
     VueComponent.prototype.__proto__ = Vue.prototype

     -->


</div>

<script type="text/javascript">
    Vue.config.printWarnings = false;
    const student = {
        name: 'student',
        template: '<div>' +
            '<h2>学生姓名:{{name}}</h2>' +
            ' <h2>年龄:{{age}}</h2>' +
            '<button>点击</button>' +
            '</div>',
        data() {
            console.log(this)
            return {
                name: '张三',
                age: 18
            }
        }
    }

    const school = Vue.extend({
        name: 'school',
        //定义组件时不用加EL选项 因为组件是一个独立的个体 不需要被挂载到页面上
        template: '<div><h2>学校名称:{{schoolName}}</h2>  <h2>地址:{{address}}</h2> <student></student></div>',
        components: {
            student
        },

        data() {
            return {
                schoolName: '北京大学',
                address: '北京',
            }
        }
    })


    console.log('@', school)
    console.log('@', student)

    const vm = new Vue({
        el: '#root',
        //第二步 注册组件
        components: {
            school
        }
    })


</script>
</body>

</html>